<?php
class LendManager extends Manager
{
	const TABLE_NAME = 'wypozyczenia';
	const PK_NAME = 'id';
	const OBJECT_NAME = 'Lend';

	public function getById($id)
	{
		$select = $this->_db->select()->from(self::TABLE_NAME)
					->where('id = ?', $id);
		return $this->_fetchObject(self::OBJECT_NAME, $select);
	}

	public function getByType($type)
	{
		$select = $this->_db->select()->from(self::TABLE_NAME)
					->where('typ = ?', $type);
		return $this->_fetchCollection(self::OBJECT_NAME, $select);
	}
	
	public function getByEmail($email)
	{
		$select = $this->_db->select()->from(self::TABLE_NAME)
					->where('email = ?', $email);
		return $this->_fetchCollection(self::OBJECT_NAME, $select);
	}

	public function getByEmailAndType($email, $type)
	{
		$select = $this->_db->select()->from(self::TABLE_NAME)
					->where('email = ?', $email)
					->where('typ = ?', $type);
		return $this->_fetchCollection(self::OBJECT_NAME, $select);
	}
}